﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../../../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="../../../lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../../../lib/json2.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
    <script src="../../../lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>

    <script src="../EmployeeData.js" type="text/javascript"></script>
    <script src="../DepartmentData.js" type="text/javascript"></script>

    <script type="text/javascript">

        var DepartmentList = DepartmentData.Rows;
        var sexData = [{ id: 1, text: '男' }, {id:2,text: '女'}];
        $(f_initGrid);
        var g = null;
        function f_initGrid()
        {
            g = $("#maingrid").ligerGrid({
                columns: [
                { display: '主键', name: 'ID', width: 50, type: 'int' },
                { display: '名字', name: 'RealName',
                    editor: { type: 'text' }
                },
                { display: '性别', width: 50, name: 'Sex', isSort: false,
                    editor: { type: 'select', data: sexData, valueColumnName: 'Sex' },
                    render: function(item)
                    {
                        if (parseInt(item.Sex) == 1) return '男';
                        return '女';
                    }
                },
                { display: '年龄', name: 'Age', width: 50, type: 'int', editor: { type: 'int'} },
                { display: '入职日期', name: 'IncomeDay', type: 'date', width: 100, editor: { type: 'date'} },
                { display: '部门', name: 'DepartmentID', width: 120, isSort: false,
                    editor: { type: 'select', data: DepartmentList, valueColumnName: 'DepartmentID', displayColumnName: 'DepartmentName' }, render: function(item)
                    { 
                        for (var i = 0; i < DepartmentList.length; i++)
                        {
                            if(DepartmentList[i]['DepartmentID'] == item.DepartmentID)
                                return DepartmentList[i]['DepartmentName']
                        }
                        return item.DepartmentName;
                    }
                },
                { display: '地址', name: 'Address',
                    editor: { type: 'text' }, align: 'left', width: 300
                }
                ],   isScroll: false, checkbox: true,
                data: EmployeeData,
                width: '95%'
            });
        }
        function f_select()
        { 
            var rows = g.getCheckedRows(); 
            
            return rows; 
        }

    </script>
</head>
<body  style="padding:4px">  
 <div class="l-clear"></div>
    <div id="maingrid" style="margin-top:0px"></div>  
  <div style="display:none;">
  <!-- g data total ttt -->
</div>
</body>
</html>
